/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package sv.com.globalsolutionslt.controlador;

import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import sv.com.globalsolutionslt.entidades.TipoContratacion;

/**
 *
 * @author karinaMelara
 */
@Stateless
public class TipoContratacionFacade extends AbstractFacade<TipoContratacion> {

    @PersistenceContext(unitName = "BoldeDeTrabajoPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public TipoContratacionFacade() {
        super(TipoContratacion.class);
    }

    public List<TipoContratacion> TipoContratacionFacadeActivo() {

        List<TipoContratacion> tipoContratacion = null;
        try {
            String sql = "SELECT tc FROM TipoContratacion tc where tc.activo=" + true;
            Query q = em.createQuery(sql);
            tipoContratacion = q.getResultList();
        } catch (NoResultException e) {
            System.out.println("Sin resultados");
        }
        return tipoContratacion;
    }
}
